package io.renren.modules.generator.service.impl;

import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;

import io.renren.modules.generator.dao.WebPartnerDao;
import io.renren.modules.generator.entity.WebPartnerEntity;
import io.renren.modules.generator.service.WebPartnerService;


@Service("webPartnerService")
public class WebPartnerServiceImpl extends ServiceImpl<WebPartnerDao, WebPartnerEntity> implements WebPartnerService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        String key = (String) params.get("key");
        IPage<WebPartnerEntity> page = this.page(
                new Query<WebPartnerEntity>().getPage(params),
                new QueryWrapper<WebPartnerEntity>().like(StringUtils.isNotBlank(key),"partner_name",key)
        );

        return new PageUtils(page);
    }

}